package upbeat.types;

import java.util.Comparator;

/**
 * This is used by our ${@link PriorityQueue} to sort the @{link Cue}s properly.
 * @author Matt
 *
 */
public class CueComparator implements Comparator<Cue> {

	/**
	 * Determines whether or not one {@link Cue} comes before another.
	 */
	@Override
	public int compare(Cue arg0, Cue arg1) {
		if( arg0 == null && arg1 == null )
			return 0;
		if( arg0 == null )
			return 1;
		if( arg1 == null )
			return -1;
        if(arg0.getTime() < arg1.getTime())
        {
            return -1;
        }
        if(arg0.getTime() > arg1.getTime())
        {
            return 1;
        }
        
		return 0;
	}

}
